package com.half_q.equipment_management_halfq.service.impl;

import com.half_q.equipment_management_halfq.dao.IUserDao;
import com.half_q.equipment_management_halfq.dao.impl.UserDaoImpl;
import com.half_q.equipment_management_halfq.service.IUserService;
import domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 简介说明: 用户服务层实现类
 *
 * @author: Half_Q_0115
 * @date: 2025/01/07 20:53:41
 * @version: 1.0
 */

@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserDaoImpl userDao;

    @Override
    public int addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public int deleteUserById(String id) {
        return userDao.deleteUserById(id);
    }

    @Override
    public boolean checkUser(String username, String password) {
        return userDao.checkUser(username, password);
    }

    @Override
    public int getIdentityById(String id) {
        return userDao.getIdentityById(id);
    }

    @Override
    public String getNameById(String id) {
        return userDao.getNameById(id);
    }

    @Override
    public boolean checkPhone(String phone_number) {
        return userDao.checkPhone(phone_number);
    }

    @Override
    public String getIdByPhone(String phone_number) {
        return userDao.getIdByPhone(phone_number);
    }

    @Override
    public int getIdentityByPhone(String phone_number) {
        return userDao.getIdentityByPhone(phone_number);
    }

    @Override
    public String getNameByPhone(String phone_number) {
        return userDao.getNameByPhone(phone_number);
    }

    @Override
    public int getCollegeIdById(String id) {
        return userDao.getCollegeIdById(id);
    }

    @Override
    public int getCollegeIdByPhone(String phone_number) {
        return userDao.getCollegeIdByPhone(phone_number);
    }

    @Override
    public List<User> findAllUser() {
        return userDao.findAllUser();
    }

    @Override
    public List<User> searchUsers(String id, String name, String gender, String college_id, String identity, String phone_number) {
        return userDao.searchUsers(id, name, gender, college_id, identity, phone_number);
    }

    @Override
    public User findUserById(String id) {
        return userDao.findUserById(id);
    }

    @Override
    public int modifyUser(User user) {
        return userDao.modifyUser(user);
    }
}
